//                           https://ac.nowcoder.com/acm/problem/26224




#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;

int main()
{
    long long n, l, r;
    cin >> n >> l >> r;
    vector<long long> arr(n);
    for (int i = 0; i < n; i++)
        cin >> arr[i];

    sort(arr.begin(), arr.end());

    int i, il, ir;
    long long sum = 0;
    for (i = il = ir = 0; i < n; i++)
    {
        while (arr[ir] <= r + arr[i] && ir < n)
            ir++;
        while (arr[il] < l + arr[i] && il < n)
            il++;

        sum += ir - il;
    }

    cout << sum << endl;

    return 0;
}